let express = require("express");
let http = require("http");
let https = require("https");
let fs = require("fs");
let path = require('path');

// Configuare https
const httpsOption = {
  cert: fs.readFileSync(path.resolve(__dirname, '../CustomSSL/server.crt')),
  key: fs.readFileSync(path.resolve(__dirname, '../CustomSSL/server.key')),
}

// Create service
let app = express();
app.use(express.static('public'));

app.get('/ping', (req, res) => {
  res.send('hello')
})

http.createServer(app).listen(80);
https.createServer(httpsOption, app).listen(443);
